﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using CokoNES.Emulator;

namespace CokoNES
{
    public partial class NesWin : Form
    {
        private Nes myEmulator;

        public NesWin()
        {
            InitializeComponent();

            myEmulator = new Nes();
        }

        private void loadRomToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var result = this.openFileDialogLoad.ShowDialog(this);

            if (result == DialogResult.OK)
            {
                var loadingState = myEmulator.LoadRom(this.openFileDialogLoad.FileName);

                // If the rom is correctly loaded into the system, we run the emulator
                if (loadingState)
                {
                    myEmulator.Run();
                }
            }
        }

        private void quitToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Environment.Exit(0);
        }
    }
}
